home *** CD-ROM | disk | FTP | other *** search
- Path: badger.wmin.ac.uk!darec
- From: darec@westminster.ac.uk (Nadarajah Thavaneethan)
- Newsgroups: comp.lang.c
- Subject: Please help me
- Date: 25 Mar 1996 18:15:17 GMT
- Organization: University of Westminster
- Message-ID: <4j6nrl$lfk@badger.wmin.ac.uk>
- NNTP-Posting-Host: badger.wmin.ac.uk
- X-Newsreader: TIN [version 1.2 PL2]
-
- #include <stdio.h>
- #include <stdlib.h>
- #define SIZE 60
-
-
- void main(void)
- {
-
- char c[SIZE];
- int index, next;
-
-
- for (index=0; index(SIZE && ( c[index] = getchar() != '\n'); index++);
- c[index] = 0;
- for(; index > 0; index--)
- for (next = 0; next < index; next++)
- compchar(c[next-1],c[next]);
-
-
- printf("\n the line is now %s\n",c);
- }
-
- void compchar (char c1, char c2)
- {
-
- char p;
-
-
- if (c1 > c2)
- p = c1;
- c1 = c2;
- c2 = p;
- }
-
-
- This program reads a line of data and sorts it into ascending ASCII sequence
- it doesn't but it should.
-
- Please mail me.
-
- darec@westminster.ac.uk
-
- Thanks in advance..
-
-
-